home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / pas_0593.zip / NORESET.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-30  |  3KB  |  134 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 273 of 319
  3. From : Marc Van Leeuwen                    2:292/405.0          26 Apr 93  16:52
  4. To   : All
  5. Subj : Intercepting [Ctrl][Alt][Del]
  6. ────────────────────────────────────────────────────────────────────────────────
  7.  * Forwarded from "PASCAL.CM"
  8.  * Originally by Marc Van Leeuwen
  9.  * Originally to ALL
  10.  * Originally dated 26 Apr 1993, 16:52
  11.  
  12. After a lot of people all over the world, have asked me for a routine,
  13. intercepting the [Ctrl][Alt][Del], I decided to post you all a routine which
  14. will do just that.
  15.  
  16. It's larger then it has to be, but that is for the following reasons:
  17.  
  18. a) it is has included a way for intercepting [Ctrl][Alt][Del] in a program AND
  19. as a TSR.
  20. b) it is also made for BP7-Protected mode, aswel as for TP 5/6/7
  21.  
  22. As BP-7-protected mode can't make any good TSR's, that function has been
  23. disabled.
  24.  
  25. For Frontdoor users, if you press [Alt][V] now, you can post this message to a
  26. file and only need to put a '{' at the beginning of the file, to be able to
  27. compile this message!
  28.  
  29. Here we go ...
  30.  
  31. ---------------------------------------------------------}
  32.  
  33. PROGRAM NoReset;
  34. {(c)1993 by Marc van Leeuwen.  Fido 2:292/405 == CompuMed 50:3214/105   }
  35. { ┌──────────┐                 Use it as you want, it works for me,     }
  36. { │PD-Program│                 but it might not work for you, so use    }
  37. { └──────────┘                 it as is, and modify the errors yourself!}
  38. Uses Crt,Dos
  39. {$IFDEF DPMI}
  40. ,WinAPI
  41. {$ENDIF};
  42.  
  43. {$F+}
  44.  
  45. { $ DEFINE TSR}
  46. {^^^^^^^^^^^^^ Take away the 2 spases to make a tsr program that intercepts}
  47. {              the reset.  it WON'T work in protected-mode!                }
  48.  
  49. {$IFDEF TSR}
  50.  {$IFDEF DPMI}
  51.   {$M 1024}
  52.  {$ELSE}
  53.   {$M 1024,0,0}
  54.  {$ENDIF}
  55. {$ENDIF}
  56.  
  57. var
  58.   Seg0000 : word;
  59.  
  60. PROCEDURE Init_Seg0000;
  61. const
  62.   Seg = $0000;
  63.   Ofs = 0;
  64. begin
  65. {$IFDEF DPMI}
  66.   Seg0000 := AllocSelector(0);
  67.   SetSelectorBase(Seg0000, Seg*Longint(16)+Ofs);
  68.   SetSelectorLimit(Seg0000, $FFFF);
  69. {$ELSE}
  70.   seg0000 := seg;
  71. {$ENDIF}
  72. end;
  73.  
  74. Const
  75.   CtrlCharacter =$4;
  76.   AltCharacter = $8;
  77.   DelCharacter = 83;
  78.  
  79. VAR OudInterupt : Procedure;
  80.  
  81. Procedure ResetIntercept; Interrupt;
  82. BEGIN
  83.   IF (Port[$60] = DelCharacter) AND
  84.      ((Mem[Seg0000:$0417] AND CtrlCharacter) = CtrlCharacter) AND
  85.      ((Mem[Seg0000:$0417] AND AltCharacter) = AltCharacter) THEN
  86.     BEGIN
  87.       Inline($FA);
  88.       Port[$20]:=$20;
  89.       Inline($FB);
  90.     END
  91.   ELSE
  92.     BEGIN
  93.       Inline($9C);
  94.       OudInterupt;
  95.     END;
  96. END;
  97.  
  98. Procedure SwitchResetOff;
  99. BEGIN
  100.   GetIntVec($09,@OudInterupt);
  101.   SetIntVec($09,@ResetIntercept);
  102. END;
  103.  
  104. Procedure SwitchResetOn;
  105. BEGIN
  106.   SetIntVec($09,@OudInterupt);
  107. END;
  108.  
  109. BEGIN
  110. {$IFDEF TSR}
  111.   {$IFDEF DPMI}
  112.     ( => TSR-programs can`t be made for DPMI-mode programs!!! <= )
  113.   {$ENDIF}
  114.   SwitchResetOff;
  115.   Keep(0);    {Start de TSR}
  116. {$ELSE}
  117.   Init_Seg0000;
  118.   SwitchResetOff;
  119.  
  120.   {Vervolgens Uw programma, zoals...}
  121.   Writeln('Ctrl-Alt-Del won''t work now!');
  122.   Repeat Until ReadKey = #27; {Escape stopt het programma}
  123.   Writeln('Ctrl-Alt-Del will be switched on.');
  124.   {En dan weer eindigen met}
  125.  
  126.   SwitchResetOn;
  127. {$ENDIF}
  128. END.
  129.  
  130. {---------------------------------------------------------
  131. Hope some of you might find it of any use.
  132.  
  133. This program is freqable and dl-able from me, as NoResetE.ARJ.  The Dutch
  134. version of this program is called NoReset.ARJ.}